package com.i7jike.com.i7jike;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

/**
 * Created by haian on 2015/8/6.
 */
public class ProjectAdapter extends ArrayAdapter {
    private String[] data;
    public ImageLoader imageLoader;
    private LayoutInflater inflater;
    public ProjectAdapter(Activity activity, String[] items){
        super(activity, R.layout.row_project, items);
        data = items;
        inflater = activity.getWindow().getLayoutInflater();
        imageLoader=new ImageLoader(activity.getApplicationContext());
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent){
        //return inflater.inflate(R.layout.row_project, parent, false);
        View vi=convertView;
        if(convertView==null)
            vi = inflater.inflate(R.layout.row_project, null);

        TextView text=(TextView)vi.findViewById(R.id.textView);;
        ImageView image=(ImageView)vi.findViewById(R.id.imageView1);
        text.setText("item " + position);
        imageLoader.DisplayImage(data[position], image);
        return vi;
    }



}
